//
//  StudioMainContentView.m
//  Arts1
//
//  Created by 孤星晨宇 on 15/10/13.
//  Copyright © 2015年 Arts1. All rights reserved.
//

#import "StudioMainContentView.h"
#import "AllHeader.h"

@implementation StudioMainContentView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        
        [self addSubview:self.backButton];
        [self addSubview:self.titleLabel];
        [self addSubview:self.subTitlelabel];
        [self addSubview:self.shareBTN];
    }
    return self;
}

- (UIButton *)backButton{
    if (!_backButton) {
        _backButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _backButton.frame = CGRectMake(8, 6, 28 , 28);
        //        [_backButton setTitle:@"<" forState:(UIControlStateNormal)];
        [_backButton setImage:[UIImage imageNamed:@"backButton"] forState:(UIControlStateNormal)];
        //        [_backButton setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    }
    return _backButton;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 5, SCREEN_WIDTH - 100, 17)];
        _titleLabel.text = @"中央美术学院";
        _titleLabel.textColor = lFONTCOLOR;
        _titleLabel.font = [UIFont boldSystemFontOfSize:16];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}

- (UILabel *)subTitlelabel{
    if (!_subTitlelabel) {
        _subTitlelabel = [[UILabel alloc] initWithFrame:CGRectMake(50, _titleLabel.bottom + 2, SCREEN_WIDTH - 100, 11)];
        _subTitlelabel.text = @"北京";
        _subTitlelabel.textColor = sFONTCOLOR;
        _subTitlelabel.font = [UIFont systemFontOfSize:12];
        _subTitlelabel.textAlignment = NSTextAlignmentCenter;
    }
    return _subTitlelabel;
}

- (UIButton *)shareBTN{
    if (!_shareBTN) {
        _shareBTN = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _shareBTN.frame = CGRectMake(SCREEN_WIDTH - 44, 3, 34 , 34);
        [_shareBTN setImage:[UIImage imageNamed:@"share"] forState:(UIControlStateNormal)];
        [_shareBTN setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
    }
    return _shareBTN;
}

- (void)setContent:(SpaceContentModel *)content{
    _content = content;
    _titleLabel.text = _content.spaceName;
    _subTitlelabel.text = _content.title;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
